﻿using LivePushFlow.Views;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace LivePushFlow.Ucs
{
    public partial class TitleBar : UserControl
    {
        private string _title;

        public TitleBar()
        {
            InitializeComponent();

            var binding = new Binding();
            binding.Source = this;
            binding.Mode = BindingMode.OneWay;
            binding.Path = new PropertyPath(nameof(this.Title));
            this.lableTitle.SetBinding(Label.ContentProperty, binding);

            var bind = new Binding();
            bind.Source = this;
            bind.Mode = BindingMode.OneWay;
            bind.Path = new PropertyPath(nameof(this.Content));
            this.contentPresenter.SetBinding(ContentPresenter.ContentProperty, bind);
        }

        public string Title
        {
            get { return (string)GetValue(TitleProperty); }
            set { SetValue(TitleProperty, value); }
        }

        public new object Content
        {
            get { return (object)GetValue(ContentProperty); }
            set { SetValue(ContentProperty, value); }
        }

        public new static readonly DependencyProperty ContentProperty =
            DependencyProperty.Register("Content", typeof(object), typeof(TitleBar), new PropertyMetadata(0));

        public static readonly DependencyProperty TitleProperty =
            DependencyProperty.Register("Title", typeof(string), typeof(TitleBar), new PropertyMetadata(string.Empty));

    }
}
